package entity

import (
	"gitee.com/mjun1833/buildnotification/model"
	"time"
)

var (
	ApeMap      = make(map[string]*APE, 0)
	TollgateMap = make(map[string]*Tollgate, 0)
)

const (
	TableNameAPE     = "ape"
	RedisCacheKeyAPE = "ape_cache"
)

type APE struct {
	Port             int                     `xorm:"port not null default 0 SMALLINT"`
	CapDirection     *model.CapDirectionType `xorm:"cap_direction not null default 0 SMALLINT"`
	ApeID            string                  `xorm:"ape_id pk not null  text"`
	Name             string                  `xorm:"name not null default '' text"`
	Model            string                  `xorm:"model not null default '' text"`
	IPAddr           string                  `xorm:"ip_addr not null default '' text"`
	IPV6Addr         string                  `xorm:"ipv6_addr not null default '' text"`
	Longitude        float64                 `xorm:"longitude not null default '' decimal"`
	Latitude         float64                 `xorm:"latitude not null default '' decimal"`
	PlaceCode        string                  `xorm:"place_code not null default '' text"`
	Place            string                  `xorm:"place not null default '' text"`
	OrgCode          string                  `xorm:"org_code not null default '' text"`
	MonitorDirection model.HDirectionType    `xorm:"monitor_direction not null default '' text"`
	MonitorAreaDesc  string                  `xorm:"monitor_area_desc not null default '' text"`
	IsOnline         model.StatusType        `xorm:"is_online not null default '' text"`
	OwnerApsID       string                  `xorm:"owner_aps_id not null default '' text"`
	UserId           string                  `xorm:"user_id not null default '' text"`
	Password         string                  `xorm:"password not null default '' text"`
	FunctionType     string                  `xorm:"function_type not null default '' text"`
	PositionType     string                  `xorm:"position_type not null default '' text"`
	AccessModel      int                     `xorm:"access_model not null default 0 int"`
	ViewDatabaseID   string                  `xorm:"view_database_id not null default '' text"`
	ExtendJson       string                  `xorm:"extend_json not null default '' text"`
	Ts               int64                   `xorm:"ts not null default 0 bigint"`
	Uts              time.Time               `xorm:"uts not null default 'now()' DATETIME"`
	OrgID            string                  `xorm:"org_id not null default '' text"`
}

func (t *APE) TableName() string {
	return TableNameAPE
}
